package rpctest;

import org.apache.hadoop.ipc.ProtocolSignature;

import java.io.IOException;

public class MyInterfaceImpl implements MyInterface {
    //实现加法
    @Override
    public int add(int number1, int number2){
        System.out.println("number1 = " + number1 + "number2 = " + number2);
        return number1 + number2;
    }
    //返回版本号
    @Override
    public long getProtocolVersion(String protocol, long clientVersion) throws IOException{
        return MyInterface.versionID;
    }

    @Override
    public ProtocolSignature getProtocolSignature(String s, long l, int i) throws IOException {
        return null;
    }
    //返回学号
    @Override
    public String get(String stdNumber1){
        if (stdNumber1.equals("G20200389020012")){
            System.out.println("Server: xuci的学号是" + stdNumber1 );
            return "xuci";
        }else if (stdNumber1.equals("20210123456789")){
            System.out.println("Server: 心心的学号是" + stdNumber1 );
            return "心心";
        }else {
            System.out.println("Server: 抱歉，无法找到学号" + stdNumber1 );
            return "null";
        }
    }



}
